package cn.dankal.flyaudio.store;

import android.webkit.WebView;

import com.tamic.jswebview.browse.JsWeb.CustomWebViewClient;
import com.tamic.jswebview.view.ProgressBarWebView;

import java.util.Map;

import cn.dankal.basiclib.base.activity.BaseActivity;
import cn.dankal.basiclib.base.activity.BaseWebviewActivity;
import cn.dankal.basiclib.util.StringUtil;
import cn.dankal.basiclib.util.WebViewUtil;
import cn.dankal.flyaudio.R;

public class WebViewActivity extends BaseActivity {

    private String url;

    private ProgressBarWebView mProgressBarWebView;


    @Override
    protected int getLayoutId() {
        return R.layout.activity_store_web;
    }

    @Override
    public void initComponents() {
        mProgressBarWebView = findViewById(R.id.login_progress_webview);
        String url = getIntent().getStringExtra("url");
        if (url.contains("ykefu.suanyun.shop")) {

        } else {
            addSingleTitleBar("详情");
        }
        mProgressBarWebView.setWebViewClient(new CustomWebViewClient(mProgressBarWebView.getWebView()) {
            @Override
            public String onPageError(String url) {
                //指定网络加载失败时的错误页面
                return "file:///android_asset/error.html";
            }

            @Override
            public Map<String, String> onPageHeaders(String url) {

                // 可以加入header

                return null;
            }


        });

        // 打开页面，也可以支持网络url
        mProgressBarWebView.loadUrl(url);
    }

}
